package com.xydtech.ecard.merchant.controller;


import com.xydtech.common.annotation.Log;
import com.xydtech.common.core.controller.BaseController;
import com.xydtech.common.core.domain.AjaxResult;
import com.xydtech.common.core.page.TableDataInfo;
import com.xydtech.common.enums.BusinessType;
import com.xydtech.common.utils.poi.ExcelUtil;
import com.xydtech.ecard.merchant.domain.EcardCustManagerMerchant;
import com.xydtech.ecard.merchant.service.IEcardCustManagerMerchantService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/*
 * 营销人员建档商户信息查询
 *@author lin
 *@version 1.0
 *@create 2023/8/2 9:37
 */
@Controller
@RequestMapping("/merchant/custManagerMerchant")
public class EcardCustManagerMerchantController extends BaseController {
    @Autowired
    private IEcardCustManagerMerchantService ecardCustManagerMerchantService;

    private String prefix = "merchant";

    @RequiresPermissions("merchant:custManagerMerchant:view")
    @GetMapping()
    public String merchant()
    {
        return prefix + "/custManagerMerchant";
    }

    @RequiresPermissions("merchant:custManagerMerchant:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(EcardCustManagerMerchant ecardCustManagerMerchant) {
        startPage();
        List<EcardCustManagerMerchant> list = ecardCustManagerMerchantService.selectCustManagerMerchantInfo(ecardCustManagerMerchant);
        return getDataTable(list);
    }

    @RequiresPermissions("merchant:custManagerMerchant:export")
    @Log(title = "导出营销人员建档商户信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(EcardCustManagerMerchant ecardCustManagerMerchant)
    {
        List<EcardCustManagerMerchant> list = ecardCustManagerMerchantService.selectCustManagerMerchantInfo(ecardCustManagerMerchant);
        ExcelUtil<EcardCustManagerMerchant> util = new ExcelUtil<EcardCustManagerMerchant>(EcardCustManagerMerchant.class);
        return util.exportExcel(list, "营销人员建档商户信息");
    }
}
